package cn.touna.jss.modules.custom.cheyiping.utils;

import cn.touna.jss.modules.custom.cheyiping.dto.MaintenanceRecordRequest;
import org.springframework.util.StringUtils;

public final class CheyipingUtil {

    public static String getRedisKey(String service,MaintenanceRecordRequest request){
        if(StringUtils.isEmpty(request.getVin()))
            return null;
        String key = "jss:cyp:" + service + ":"+getString(request.getVin())+":"+getString(request.getPlateNo())+":"+ getString(request.getEngineNo());
        return key;
    }

    private static String getString(String value){
        if(value==null)
            return "";
        return value;
    }
}
